Skip to main content

Configuring the driver

To use the driver, first, fetch the sources into your GOPATH.

go get github.com/arangodb/go-driver

Using the driver, you always need to create a Client. The following example shows how to create a Client for a single server running on localhost.

import (
"fmt"
driver "github.com/arangodb/go-driver"
"github.com/arangodb/go-driver/http"
)

...

conn, err := http.NewConnection(http.ConnectionConfig{
Endpoints: []string{"http://localhost:8529"},
})
if err != nil {
// Handle error
}
client, err := driver.NewClient(driver.ClientConfig{
Connection: conn,
})
if err != nil {
// Handle error
}

Once you have a Client you can access/create databases on the server, access/create collections, graphs, documents, and so on.